<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>国内折扣</title>
    <link rel="stylesheet" href="../css/国内折扣.css">
</head>
<body>
    <div class="head">
        <a href="../index.html" class="left"><img src="../img/left.jpg" alt=""></a>
        <h4>国内折扣</h4>
        <a href="#" class="right"><img src="../img/xiazai1.jpg" alt=""></a>
    </div>

    <main class="product">
       
    </main>


    <section id="footer">
        <div id="chart">
            <span>品牌排行</span>
            <a href=""><img src="./img/left.jpg" alt=""></a>
        </div>
        <div id="login">
            <div id="row">
                <a href=""><div>登入</div></a>
                <a href=""><div>注册</div></a>
                <div class="gotop">返回顶部</div>
            </div>
            <div id="conter">
                <p>
                    <a href="">手机APP下载</a>
                    <a href="">万锋智慧商城手机版</a>
                    <span>--掌上比价平台</span>
                </p>
                <p>chst.vip:8081/cm</p>
            </div>
        </div>

    </section>
</body>
</html>
<script src="../适配/flexible.js"></script>
<script src="../jquery.min.js"></script>

<script>
    function scrollHandler() {
        const height = $(this).scrollTop()
        if (height >= 300) {
            $('.gotop').fadeIn(500)
        } else {
            $('.gotop').fadeOut(500)
        }
    }

    scrollHandler()
    $(window).scroll(scrollHandler)

    $('.gotop').click(function () {
        $('body, html').animate({ scrollTop: 0 }, 1000)
    })


    let regExp = /^<[^<]+\s+src="([^''""]*)"/
    fetch('http://chst.vip:1234/api/getinlanddiscount')
        .then(body => body.json())
        .then(res => {
            console.log(res);
            let data = res.result
            let html = ''
            let product = document.querySelector('.product')
            data.forEach(item => {
                html += `
                <div id="minMain">
        <a href="">
        ${item.productImg}
            <div>${item.productName}</div>
            <p id="price">${item.productPrice}</p>
            <p>${item.productFrom} | ${item.productTime}</p>
        </a>
    </div>
                `
            })
            product.innerHTML = html
        })


</script>

